class Solution {
public:
    string removeDuplicates(string s) {
        string ret;
        for(int i=0;i<s.size();++i)
        {
            if(ret.empty()||s[i]!=ret.back())
            {
                ret.push_back(s[i]);
            }
            else 
            {
                ret.pop_back();
            }
        }
        return ret;
    }
};
